package com.lhl.fw.db.biz.domain.entity;

import com.lhl.fw.db.biz.domain.dto.TelDTO;
import com.lhl.fw.db.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.annotations.Type;

import javax.persistence.*;
import java.io.Serializable;
import java.util.List;

@Entity
@Getter
@Setter
@NoArgsConstructor
@ToString(exclude="address")
public class Person extends BaseEntity<String> implements Serializable {

	@Column(name = "NAME")
	@ApiModelProperty(value = "姓名")
	private String name;
	@Column(name = "AGE")
	@ApiModelProperty(value = "年龄")
	private Integer age;
	@OneToOne(mappedBy="person",cascade=CascadeType.ALL,fetch=FetchType.LAZY)
	private Address address;

	@ApiModelProperty(value = "电话号码")
	@Type(type = "json")
	@Column(name = "TELS", columnDefinition = "json")
	private List<TelDTO> tels;
}
